﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl;
using Topshelf;

namespace ServiceContainer
{
    class QuartzServiceRunner
    {
        private readonly IScheduler scheduler;

        public QuartzServiceRunner()
        {
            //创建一个作业调度池
            scheduler = StdSchedulerFactory.GetDefaultScheduler();
        }

        public void Start()
        {
            //启动任务
            scheduler.Start();

        }

        public void Stop()
        {
            scheduler.Clear();
        }

        public bool Continue(HostControl hostControl)
        {
            scheduler.ResumeAll();
            return true;
        }

        public bool Pause(HostControl hostControl)
        {
            scheduler.PauseAll();
            return true;
        }

    }
}
